//
//  ModemUSB.h
//  Simples
//
//  Created by Farlei Heinen on 08/04/09.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import <stdio.h> 
#import <string.h> 
#import <unistd.h> 
#import <fcntl.h> 
#import <sys/ioctl.h> 
#import <errno.h> 
#import <paths.h> 
#import <termios.h> 
#import <sysexits.h> 
#import <sys/param.h> 
#import <sys/select.h> 
#import <sys/time.h> 
#import <time.h> 

#import <CoreFoundation/CoreFoundation.h> 

#import <IOKit/IOKitLib.h> 
#import <IOKit/serial/IOSerialKeys.h> 
#import <IOKit/IOBSD.h> 

#import <Foundation/Foundation.h>


#define LOCAL_ECHO 
#ifdef LOCAL_ECHO 
#define kOKResponseString "AT\r\r\nOK\r\n"
#else 
#define kOKResponseString "\r\nOK\r\n" 
#endif

#define kATCommandString        "AT\r\n"
#define kATTextModeString		"AT+CMGF=1\r\n"
#define kATSendSMSString		"AT+CMGS=\""
#define kATEnd					"\r\n"
#define kMyErrReturn            -1 

enum 
{ 
    kNumRetries = 3 
}; 

@interface ModemUSB : NSObject 
{
	struct termios gOriginalTTYAttrs; // original modem attributes	
	int fileDescriptor;
}

+ (kern_return_t) findModems: (io_iterator_t*) matchingServices; 
+ (kern_return_t) getModemPath: (io_iterator_t) serialPortIterator devPath: (char*) deviceFilePath pathSize: (CFIndex) maxPathSize;
- (int) openSerialPort: (const char *) deviceFilePath;
- (char*) logString: (char*) str;
- (Boolean) initModem;
-(void) closeSerialPort;
-(Boolean) sendSMS: (char*) msg toNumber: (const char*) number;
@end
